<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<style type="text/css">
		.nomeQuery {
			width: 200px;
			text-align: center;
		}
		
		.inicioQuery {
			width: 50px;	
			text-align: left;
		}
		
		.fimQuery {
			width: 50px;
			text-align: left;
		}
		
		.sequenciaQuery {
			width: 300px;
			text-align: left;
		}
		
		.nomeSubject {
			width: 300px;
			text-align: center;
		}
		
		.inicioSubject {
			width: 50px;	
			text-align: left;
		}
		
		.fimSubject {
			width: 50px;
			text-align: left;
		}
		
		.sequenciaSubject {
			width: 500px;
			text-align: left;
		}
		
		.evalue {
			width: 50px;
			text-align: center;
		}
		
		.score {
			width: 50px;
			text-align: center;
		}
		
		.identidade {
			width: 50px;
			text-align: right;
		}
	
	</style>
</h:head>
<h:body onload="foco();">
	<ui:composition template="../template.xhtml">
		<ui:define name="miolo">
   			<p:growl id="erros"/> 
			<h:form id="LSAnalise">
				<p:panel id="panel" header="#{msgs.blastExecute}">
					<table width="100%">
						<tr>
							<td>
								<p:fieldset legend="Query">
									<table>
										<tr>
											<td class="rotulo">
												<h:outputText value="#{msgs.sequenceFasta}:"/>
											</td>
										</tr>
										<tr>
											<td colspan="2">
												<p:inputTextarea style="font: 12px Courier New" rows="10" cols="100" autoResize="false" value="#{blastFrm.sequenciaFasta}"/>
    										</td>
										</tr>
										<tr>
											<td>
												<h:outputText value="#{msgs.optionUpload}"/>
											</td>
										</tr>
										<tr>
											<td class="rotulo">
												<h:outputText value="#{msgs.fasta}:"/>
											</td>
											<td align="right">
												<p:fileUpload
													fileUploadListener="#{blastFrm.fastaFileUpload}"
													 mode="advanced" label="Upload" allowTypes="fasta"/>
											</td>
										</tr>	
									</table> 
								</p:fieldset>
							</td>
						</tr>
						<tr>
							<td>
								<p:fieldset legend="#{msgs.parametros}">
									<table>
										<tr>
											<td>
												<h:outputText value="-gap open: " />
											</td>
										  	<td> 
										        <p:selectBooleanCheckbox value="#{blastFrm.gapOpen}" />  
										  	</td>
										  	<td>
										  		&nbsp;
										  	</td>
										  	<td>
										        <h:outputText value="-gap extended: " />
										    </td>
										  	<td>  
										        <p:selectBooleanCheckbox value="#{blastFrm.gapExtends}"/>  
											</td>
											<td>
										  		&nbsp;
										  	</td>
										  	<td>
										        <h:outputText value="-w: " />
										    </td>
										  	<td>  
										        <p:selectBooleanCheckbox value="#{blastFrm.opcaoW}"/>

											</td>
											<td>
										        <p:inputText value="#{blastFrm.valorWordSize}" size="5"/>  
											</td>
											<td>
										  		&nbsp;
										  	</td>
										  	<td>
										        <h:outputText value="-e (e-value): " />
										    </td>
										  	<td>  
										        <p:selectBooleanCheckbox value="#{blastFrm.evalue}"/>
										    </td>
										    <td>
										    	&nbsp; 
										        <p:inputText value="#{blastFrm.valorEvalue}" size="5"/> 
										    </td>
										</tr>	
									</table>					
								</p:fieldset>
							</td>
						</tr>
						<tr>
							<td>
								<p:fieldset legend="Subject">
									<table>
										<tr>
											<td>
												<h:outputText value="Gene:" /> &nbsp; 
												<h:selectOneMenu
													styleClass="select" id="arquivoFasta"
													value="#{blastFrm.arquivoFastaSelecionado}">
													<f:selectItems value="#{blastFrm.arquivosFasta}" />
												</h:selectOneMenu>
											</td>
											<td>
												<p:commandButton
													value="#{msgs.blastExecute}" 
													action="#{blastFrm.executeBlast}"
													update="tabela,erros" />
											</td>
										</tr>	
									</table>					
								</p:fieldset>
							</td>
						</tr>
					</table>
					<table width="100%">
						<tr>
							<td><h:panelGrid style="width:100%">
									<p:dataTable value="#{blastFrm.colecaoBlast}"
										emptyMessage="#{msgs.naoHaDados}" id="tabela" 
										var="item" paginator="true" rows="10"
										paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
        								rowsPerPageTemplate="10,20,50">
	        		
								        <p:columnGroup type="header">  
								            <p:row>
								            	<p:column headerText=" " />
								                <p:column colspan="3" headerText="Query" />  
								                <p:column colspan="3" headerText="Subject" />  
								            </p:row>  

								            <p:row>
								            	<p:column headerText=" " />  
								                <p:column headerText="#{msgs.nameColumn}" />  
								                <p:column headerText="#{msgs.startColumn}" />  
								                <p:column headerText="#{msgs.endColumn}" />
								                
								                <p:column headerText="#{msgs.nameColumn}" />  
								                <p:column headerText="#{msgs.startColumn}" />  
								                <p:column headerText="#{msgs.endColumn}" />
								                
								                <p:column headerText="#{msgs.eValueColumn}" />  
								                <p:column headerText="#{msgs.scoreColumn}" />  
								                <p:column headerText="#{msgs.identityColumn}" />   
								            </p:row>  
								        </p:columnGroup>
								        
								        <p:column>  
								            <p:rowToggler />  
								        </p:column> 

							            <p:column> 
											<h:outputText value="#{item.nomeQuery}" />
										 </p:column> 
											
										<p:column>  
								            <h:outputText value="#{item.inicioQuery}" /> 
								        </p:column>  
								  
								        <p:column>  
								            <h:outputText value="#{item.fimQuery}" /> 
								        </p:column>  
								  
								        <p:column>  
								           <h:outputText value="#{item.nomeSubject}" />  
								        </p:column>  
								  
								        <p:column>  
								            <h:outputText value="#{item.inicioSubject}" />  
								        </p:column>
								        
								        <p:column>  
								           <h:outputText value="#{item.fimSubject}" />  
								        </p:column>
								        
								        <p:column>  
								            <h:outputText value="#{item.eValue}" />  
								        </p:column>
								        
								        <p:column>  
								            <h:outputText value="#{item.score}" />  
								        </p:column>
								        
								        <p:column>  
								            <h:outputText value="#{item.identidade}" /> 
									    </p:column>
									    
									    <p:rowExpansion>
									    
									    	<h:outputText value="Query: " />
								    		<p:column> 
								        		<h:outputText value="#{item.coberturaQuery}" />
								        	</p:column>
									    	<p></p>
									    	<h:outputText value="Subject: " />
										    <p:column>  
									            <h:outputText value="#{item.coberturaSubject}" />
										    </p:column>  
							  
							        	</p:rowExpansion>     
							        									
									</p:dataTable>
								</h:panelGrid>
							</td>
						</tr>
						<tr>
							<td><h:panelGrid style="width:100%">
									<p:panel header="#{msgs.exportColumn}">
										<h:commandLink>
											<p:graphicImage title="#{msgs.exportColumn} Excel"
												value="../images/excel.png" />
											<p:dataExporter type="xls" target="tabela" fileName="Resumo"
												excludeColumns="0" />
										</h:commandLink>

										<h:commandLink>
											<p:graphicImage title="#{msgs.exportColumn} PDF"
												value="../images/pdf.png" />
											<p:dataExporter type="pdf" target="tabela" fileName="Resumo"
												excludeColumns="0" />
										</h:commandLink>

										<h:commandLink>
											<p:graphicImage title="#{msgs.exportColumn} CSV"
												value="../images/csv.png" />
											<p:dataExporter type="csv" target="tabela" fileName="Resumo"
												excludeColumns="0" />
										</h:commandLink>

										<h:commandLink>
											<p:graphicImage title="#{msgs.exportColumn} XML"
												value="../images/xml.png" />
											<p:dataExporter type="xml" target="tabela" fileName="Resumo"
												excludeColumns="0" />
										</h:commandLink>

									</p:panel>
								</h:panelGrid>
							</td>
						</tr>
					</table>
				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>


